package com.tencent.sr.iris.activity.service.event.handler;

import com.tencent.sr.iris.activity.domain.event.dto.ActivityDTO;
import com.tencent.sr.iris.activity.domain.event.dto.ActivityTaskDTO;
import com.tencent.sr.iris.activity.interfaces.event.dto.ActivityEventDTO;
import com.tencent.sr.iris.activity.service.activity.IrisActivityService;
import com.tencent.sr.iris.activity.service.event.activity.IrisActivityExecutor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.util.List;

/**
 * Copyright (C) 2023 Limited, a Tencent company. All rights reserved.
 * 月月领事件处理器
 *
 * @author p_htaozhou@tencent.com
 * @create 2023/8/11 12:02
 */

@Slf4j
@Component("MONTH_GIFT_JOB")
public class MonthGiftEventHandler extends AbstractIrisEventHandler {

    @Resource
    private IrisActivityService activityService;

    @Override
    void process(ActivityEventDTO eventDTO, List<String> eventHandingInfoList) {
        // 补充事件pid
        addParameterForEvent(eventDTO);
        // 查询月月领活动
        ActivityDTO activityDTO = activityService.getActivity(activityConfig.getMonthGiftActivityId());
        IrisActivityExecutor activityExecutor = getActivityExecutor(eventDTO, activityDTO);
        activityExecutor.execute(eventDTO, activityDTO);
        eventHandingInfoList.add(this.getClass().getSimpleName() + "处理成功,idempotent:" + eventDTO.getIdempotent());
    }

    @Override
    List<ActivityTaskDTO> getRelatedTaskList(String eventType) {
        return null;
    }

    @Override
    void baseDataProcess(ActivityEventDTO eventDTO) {

    }

    @Override
    public void after(ActivityEventDTO eventDTO) {

    }
}
